class MyException(Exception):
"""
也可继承RuntimeError
"""
    def __init__(self):
        Exception.__init__()

if __name__ == '__main__':
    try:
        a = 3/0
        raise MyException()
    except MyException:
        print("抛出了异常")